//
//  EvaluateStatisticsViewController.m
//  AnXin100
//
//  Created by Sakura on 2018/11/8.
//  Copyright © 2018 tzhg. All rights reserved.
//

#import "EvaluateStatisticsViewController.h"
#import "ZXSampleStarAppraiseView.h"
#import "ORChartView.h"

@interface EvaluateStatisticsViewController ()
@property (nonatomic, strong) ORChartView *chartView;
@end

@implementation EvaluateStatisticsViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
    
    UILabel *label = [UILabel getCustomLabel:[UIColor colorWithHex:0x333333] font:[UIFont systemFontOfSize:16] rect:CGRectMake(0, Hn, SCREEN_WIDTH, 35)];
    label.text = @"累计评价次数";
    label.textAlignment = NSTextAlignmentCenter;
    [self.view addSubview:label];
    UIView *line = [[UIView alloc] initWithFrame:CGRectMake(0, 34, SCREEN_WIDTH, 1)];
    line.backgroundColor = [UIColor colorWithHex:0xf4f4f4];
    [label addSubview:line];
    
    CGFloat y = 0;
    NSArray *array = @[@"五星好评", @"四星好评", @"三星好评", @"二星好评", @"一星好评"];
    for (NSInteger i = 0; i < array.count; i++) {
        UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(label.frame) + 10 + 40 * i, SCREEN_WIDTH, 40)];
        CGFloat width = [array[i] textSizeWithFont:[UIFont systemFontOfSize:14] limitWidth:SCREEN_WIDTH].width;
        
        UILabel *titleLabel = [UILabel getCustomLabel:[UIColor colorWithHex:0x999999] font:[UIFont systemFontOfSize:14] rect:CGRectMake(10, 10, width + 10, 20)];
        titleLabel.text = array[i];
        [view addSubview:titleLabel];
        
        ZXSampleStarAppraiseView *starView = [[ZXSampleStarAppraiseView alloc] initWithFrame:CGRectMake(CGRectGetMaxX(titleLabel.frame) + 10, 10, 80, 20)];
        starView.score = 5 - i;
        [view addSubview:starView];
        
        [self.view addSubview:view];
        
        UILabel *numberLabel = [UILabel getCustomLabel:[UIColor colorWithHex:0x999999] font:[UIFont systemFontOfSize:12] rect:CGRectMake(SCREEN_WIDTH - 30, 10, 50, 20)];
        numberLabel.text = @"10次";
        numberLabel.textAlignment = NSTextAlignmentRight;
        [view addSubview:numberLabel];
        y = CGRectGetMaxY(view.frame);
    }
    
    _chartView = [[ORChartView alloc]initWithFrame:CGRectMake(0, y + 30, [UIScreen mainScreen].bounds.size.width, SCREEN_HEIGHT - y - 50) dataSource:@[@"51",@"110", @"160",@"160", @"140", @"130", @"200", @"250"] countFoyY:7];
    
    _chartView.titleForX = @"日期/日";
    _chartView.titleForY = @"订单投诉次数";
    
    [_chartView pointDidTapedCompletion:^(NSString *value, NSInteger index) {
        NSLog(@"....%@....%ld", value, (long)index);
    }];
    _chartView.style = 0;
    [self.view addSubview:_chartView];
    
}



@end
